import React, { useState } from 'react';
import { SortableElement} from 'react-sortable-hoc';
const SortableItem = SortableElement((props: any) => <tr {...props} />);

const DraggableBodyRow: React.FC<any> = (props: any) => {
  const { className, style, ...restProps } = props;
  const [ dataSource ] = useState(props.columns);
  const index = dataSource.findIndex((x: any) => x.key === restProps['data-row-key']);
  return <SortableItem index={index} {...restProps} />;
}

export default DraggableBodyRow;
